import { defineStore } from 'pinia'
import { inject, ref } from 'vue'
import { computed } from 'vue'


export const useUserStore = defineStore('user', () => {
    const name = ref('张三')
    const age = ref(18)

    const connectName = computed(() => {
        return name.value + inject('pinia')
    })

    const setName = (val) => {
        name.value = val
    }
    const $reset = () => {
        name.value = '张三'
    }

    return {
        name,
        age,
        setName,
        connectName,
        $reset
    }
})